package cn.krui.helper.bean;

import java.io.Serializable;

/**
 * @author zc
 */
public class DataSingle<T> implements Serializable {
    /**
     * 页大小
     */
    private Integer pageSize;
    /**
     * 当前页
     */
    private Integer pageIndex;
    /**
     * 当前实体数据
     */
    private T dataSingle;
    /**
     * 扩展数据
     */
    private Object extend;

    /**
     * 每页最大数据条数
     */
    private final Integer MAX_PAGESIZE = 400;

    public Integer getPageSize() {
        if (pageSize == null){
            return 100;
        }
        if(pageSize > MAX_PAGESIZE) {
            return MAX_PAGESIZE;
        }
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getPageIndex() {
        if (pageIndex == null){
            return 1;
        }
        return pageIndex;
    }

    public void setPageIndex(Integer pageIndex) {
        this.pageIndex = pageIndex;
    }

    public T getDataSingle() {
        return dataSingle;
    }

    public void setDataSingle(T dataSingle) {
        this.dataSingle = dataSingle;
    }

    public Object getExtend() {
        return extend;
    }

    public void setExtend(Object extend) {
        this.extend = extend;
    }

}